|
|
|
|
|
|
|
' Arccos(O) is Pi. 2 * Pi is the number of radians in a circle.
' 2 * Pi / PointCount is the angle (in radians) between points.
AngleIncrement = 2 * Arccos(O) / PointCount
ReDim PointArray(PointCount)
' The Cos and Sin functions obtain the X and Y location along a circle
' for a given angle.
For PointNumber = 0 To PointCount - 1
PointArray(PointNumber).X = Cos(PointNumber * PointCount) * _
Radius + Xoffset
PointArray(PointNumber).y = Sin(PointNumber * PointCount) * _
Radius + Yoffset
Next PointNumber
' Return to the original point
LSet PointArray(PointCount) = PointArray(O)
' Don't move the first or last point
For PointNumber = 1 To PointCount
' Swap each point with a random point
SwapPoint = Int(Rnd() * PointCount)
LSet TempPoint = PointArray(SwapPoint)
LSet PointArray(SwapPoint) = PointArray(PointNumber)
LSet PointArray(PointNumber) = TempPoint
Next PointNumber
End Sub
Private Sub chkAuto_Click()
Timerl.Enabled = chkAuto.Value
End Sub
Private Sub cmdClear_Click()
' Clear the form
Me.Cls
End Sub
Private Sub cmdDraw_Click()
Dim points As Long
Dim Radius As Long
' The number of points is retrieved from the text box
points = txtPoints.Text
If points = 0 Then points = 2
' The radius is the smaller of half the height or width |
|
|
|
|
|